<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sd" uri="/struts-dojo-tags" %>
<html>
<head><sd:head/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LM Design</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="form.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="stmenu.js"></script>
</head>
<body>

<div class="bodybox">
<div class="headerbar_top"> You are logged in as Admin !</div>
<div class="header">

</div>
<div class="wrapper">
<div class="navigation">
<a href="http://www.dhtml-menu-builder.com"  style="display:none;visibility:hidden;">Navigation Menu</a>
<s:set name="webFramework" value="#session['USERROLE']"/>
<s:if test="%{#webFramework=='Operator'}">
	<script type="text/javascript" src="operator.js"></script>
</s:if>
<s:if test="%{#webFramework=='Authorizer'}">
	<script type="text/javascript" src="authorizer.js"></script>
</s:if>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</div>
<!-- navigation end-->
<div class="content">
<h4>Search Transaction to Edit</h4>

<s:form action="searchEditTrx" method="POST" theme="simple">
<%-- <s:head theme="ajax" /> --%>
	<table>
	<tr>	    
		<td class="right"><label for="formId">Form ID</label></td>
	    <td class="left">&nbsp;</td>
	    <td class="left"><s:textfield id="formId1" name="formId" tabindex="1"/></td>
	</tr>
	<tr>
		 <td class="right"><label for="locId">Location Code</label></td>
	    <td class="left">&nbsp;</td>
	    <td class="left">
	    	<s:select id="locationId" name="locId" list="locations" listKey="locId" listValue="locName" headerKey="" headerValue="-- select location --"/>	    
	    </td>
	  
	</tr>

	 <tr>
		<td class="right"><label for="trnsDate">Transaction Date</label></td>
	    <td class="left">&nbsp;</td>
	    <td class="left">
	    	<sd:datetimepicker id="dateId" name="txDate" displayFormat="yyyy-MM-dd"/> 
	    </td>
	</tr>  
	<%-- <tr>
	    <td class="left"><s:textfield label="Person ID"  name="personId" tabindex="5"/> 
	    </td>
	</tr> --%>
	<tr>
		<td class="right"><label for="trnsType">Transaction Type</label></td>
	    <td class="left">&nbsp;</td>
		<td class="left">
				<s:radio name="txTye" list="#{'Debit':'Debit','Credit':'Credit'}"  tabindex="6"/>
		</td>
	</tr>

<%-- 	<tr>
	    <td>
			<s:radio  label="Status" name="status" list="#{'New':'New','Approved':'Approved'}"  tabindex="8"/>
		</td>
	</tr> --%>
	<tr>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	  </tr>
	<tr>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	    <td><s:submit value="Search"  align="center" onclick="return validateData();"/></td>
	  </tr>
	</table>
 </s:form>
 <p id="information">Click on Form ID to edit.</p>
<table>
	<tr>
		<th class="left border" >Form ID</th>
	    <th class="left border">Location Code</th>
	    <th class="left border">Amount</th>
	    <th class="left border">Transaction Date</th>
	    <th class="left border">Person Name</th>
	    <th class="left border">Transaction Type</th>
	    <th class="left border">Authorizer Name</th>
	    <th class="left border">Status</th>
	    <th class="left border">Edit</th> 
	</tr>
	<s:iterator value="accounts" status="trx">
        <tr>
            <td class="nowrap">
            <%-- <s:url id="update" action="editTrx">
		       		   <s:param name="formId" value="formId"/>
		       		</s:url> 
                <s:a href="%{update}"> --%> <s:property value="formId"/>
           <%--      </s:a> --%>
           </td>
            <td class="nowrap"><s:property value="locName"/></td>
            <td class="nowrap"><s:property value="amount"/></td>
            <td class="nowrap"><s:property value="txDate"/></td>            
            <td class="nowrap"><s:property value="personName"/></td>
            <td class="nowrap"><s:property value="txTye"/></td>
            <td class="nowrap"><s:property value="authName"/></td>
            <td class="nowrap"><s:property value="status"/></td>   
            <td>
            	<s:url id="update" action="editTrx">
		       		   <s:param name="formId" value="formId"/>
		       		</s:url> 
                <s:a href="%{update}">Edit </s:a>
            </td>         
        </tr>  		
	 </s:iterator>	
</table>
 
</div>
<!-- content end-->
</div> 
<!-- wrapper end-->
<div class="bottom_strip"></div>
<div class="headerbar_bottom">
&copy; Copyright 2011. Dera Sacha Sauda, Sirsa-125055 (Haryana)
<br />
Designed By: DSS IT WING</div>
</div>

<script type="text/javascript">
	function validateData(){
		var formid1 = document.getElementById('formId1').value;
		var location1 = document.getElementById('locationId').value;
		var trxDate = document.getElementsByName('dojo.txDate')[0].value;
		var checked = false;
		var buttons = document.getElementsByName('txTye');
		for (var i=0; i<buttons.length; i++) 
		{ 
		 if (buttons[i].checked) {				
		  checked = true;
		  break; 
		 } 
		}
		
		if((formid1==null || formid1=="") && (location1==null || location1=="") && (trxDate==null || trxDate=="") && (!checked)){
			alert("Please select atleast one filter condition");
			return false;
		}else{
			return true;
		}
		
	}
</script>

</body>
</html>